﻿using DKPScoreWebApi.DTOs.Requests;
using DKPScoreWebApi.DTOs.Results;
using DKPScoreWebApi.Models;

namespace DKPScoreWebApi.Services.Interfaces
{
    /// <summary>
    /// 工会管理服务接口
    /// 定义工会相关的业务逻辑操作
    /// </summary>
    public interface IGuildService
    {
        /// <summary>
        /// 创建新工会
        /// </summary>
        /// <param name="userId">创建者用户ID</param>
        /// <param name="request">创建工会请求数据</param>
        /// <returns>创建的工会实体</returns>
        Task<Guild> CreateGuildAsync(int userId, CreateGuildRequest request);

        /// <summary>
        /// 获取用户管理的所有工会
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>工会列表</returns>
        Task<List<Guild>> GetUserGuildsAsync(int userId);

        /// <summary>
        /// 根据ID获取工会详情
        /// </summary>
        /// <param name="guildId">工会ID</param>
        /// <returns>工会实体</returns>
        Task<Guild> GetGuildByIdAsync(int guildId);

        /// <summary>
        /// 检查用户是否有指定工会的管理权限
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="guildId">工会ID</param>
        /// <returns>true表示有权限，false表示无权限</returns>
        Task<bool> IsUserGuildAdminAsync(int userId, int guildId);

        /// <summary>
        /// 添加工会管理员
        /// </summary>
        /// <param name="guildId">工会ID</param>
        /// <param name="targetUserId">目标用户ID</param>
        /// <param name="role">管理员角色</param>
        /// <param name="addedBy">添加者用户ID</param>
        /// <returns>true表示添加成功，false表示失败</returns>
        Task<bool> AddGuildAdminAsync(int guildId, int targetUserId, string role, int addedBy);

        /// <summary>
        /// 获取工会统计信息
        /// </summary>
        /// <param name="guildId">工会ID</param>
        /// <returns>工会统计数据</returns>
        Task<GuildStats> GetGuildStatsAsync(int guildId);

        /// <summary>
        /// 更新工会信息
        /// </summary>
        /// <param name="guildId">工会ID</param>
        /// <param name="request">更新请求数据</param>
        /// <returns>true表示更新成功，false表示失败</returns>
        Task<bool> UpdateGuildAsync(int guildId, CreateGuildRequest request);

        /// <summary>
        /// 删除工会（软删除）
        /// </summary>
        /// <param name="guildId">工会ID</param>
        /// <returns>true表示删除成功，false表示失败</returns>
        Task<bool> DeleteGuildAsync(int guildId);
    }
}
